//
//  AiMemoryBean.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/9/21.
//
import Foundation
import LeanCloud
import GRDB

public class AiMemoryBean : ICloudTable,IDbTable, Identifiable {
    
    public static let databaseTableName = "AiMemory"

    func getCloudTable() -> String {
        return "AiMemory"
    }
    
    func doCustomExcluded() -> [String? : Any?] {
        return doExcluded(subject: self, excluded: ["modifySign"])
    }
    
    
    //db排除字段
    func doCustomDBExcluded()  -> [String? : Any?] {
        return doExcluded(subject: self, excluded: [""])
    }
    
    var objectId: String?
    var content: String? = nil
    var aiRoleId: String? = nil
    var userId: String? = nil
    var count: Int = 0
    var roleType: Int = IRoleType.USER.rawValue //角色类型
    var createTime: Int64 = 0//创建时间
    var updateTime: Int64 = 0//更新时间时间
    var modifySign: Bool = false//修改标识
    var status: Int = IStatusType.NORMAL.rawValue
    
    
    //json解析白名单
    private enum CodingKeys: String, CodingKey {
        case objectId
        case content
        case aiRoleId
        case userId
        case count
        case roleType
        case createTime
        case updateTime
//        case modifySign
        case status
    }
}


extension AiMemoryBean {
    // db数据库指定字段
    public func encode(to container: inout PersistenceContainer) {
        doDBExcluded(to: &container)
    }
}
